package com.cosmoplat.mom.iot.client.api.param;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author yotta
 * @date 2025/6/16
 */
@EqualsAndHashCode(callSuper = true)
@Data
public abstract class BaseIotPageParam extends BaseIotParam {

    /**
     * 当前页码，从1开始
     */
    private Integer pageNum = 1;

    /**
     * 每页大小
     */
    private Integer pageSize = 10;

    @Override
    public void check() {

        // 页码和每页大小必须大于0
        if (pageNum == null || pageNum <= 0) {
            throw new IllegalArgumentException("pageNum must be greater than 0");
        }
        if (pageSize == null || pageSize <= 0) {
            throw new IllegalArgumentException("pageSize must be greater than 0");
        }
    }
}
